<style type="text/css">
    .el-radio+.el-radio {
        margin-left: 13px;
    }
    .el-radio__label {
        font-size: 14px;
        padding-left: 6px;
    }
    .newdate {
        width: auto !important;
    }
     .el-tree{
    width: 100%;
    overflow-x: scroll;
    height: 720px;
    }
    .el-tree>.el-tree-node{
    display: inline-block !important;
    }
</style>
<template>
	<section>
					<!--工具条-->
             <el-row>         
             <el-col :span="23" class="toolbar toolMarginTop" id="serachId">
                <el-form :inline="true" :model="filters">
                    <el-button type="primary" @click="userAdd" style="float:left;" size="small">新增用户</el-button>
                    <el-button type="primary" style="float:left;" size="small" @click="resetPassword">重置密码</el-button>
                    <el-button type="primary" style="float:left;" size="small" @click="unlock">用户解锁</el-button>
                    <el-form-item style="float:right">
                        <el-button type="primary" v-on:click="getUserList" size="small">查询</el-button>
                    </el-form-item>
                    <el-form-item style="float:right">
                        <el-input v-model="filters.name" placeholder="请输入用户名称" size="small" @keyup.enter.native="searchEnterFun"></el-input>
                    </el-form-item>
                </el-form>
            </el-col>
			</el-row>		
				<el-row class="tac toolbar titleLineSymbolTwo">
                    <el-col :span="4">
						<!-- 13123464879846 -->
						<!-- <el-tree @check-change="toGetList" node-key="code" ref="tree" :load="loadData" :props="defaultProps"   lazy  show-checkbox></el-tree> -->
                        <el-tree @node-click="toGetList" :data="treeData" node-key="orgSerialNo" ref="tree" :props="defaultProps" :expand-on-click-node="false"   :default-expand-all="false">
                            <span class="custom-tree-node" slot-scope="{ node, data }">
                                <span>{{ node.data.name }}</span>
                                <!-- <span>
                                <el-button type="text" size="mini"  @click="() => append(data)">Append
                                </el-button>
                                <el-button type="text" size="mini" @click="() => remove(node, data)">Delete
                                </el-button>
                                </span> -->
                            </span>
                        </el-tree>
					</el-col>
					<el-col :span="20" >
						<!--列表-->
						<el-table :data="tableData" highlight-current-row v-loading="listLoading" style="width: 100%;">
                            <el-table-column type="selection" width="55" :selectable="selectable">
                            </el-table-column>
							<el-table-column type="index" label="序号" width="80">
							</el-table-column>
							<el-table-column prop="name" label="用户名" width='100'>
							</el-table-column>
							<!-- <el-table-column prop="userNum" label="用户编号">
							</el-table-column> -->
							<!-- <el-table-column prop="jobCategory" label="职务类型">
                                <template scope="scope">
                                    <span v-html="formatDicTionary(scope.row.jobCategory,'jobCategory')"></span>
                                </template>
							</el-table-column> -->
							<!-- <el-table-column prop="loginId" label="登入名">
							</el-table-column> -->
							<!-- <el-table-column prop="idCard" label="身份证" min-width="200">
							</el-table-column> -->
							<!-- <el-table-column prop="birthday" label="出生年月" min-width="100" :formatter="formatBirthday">
							</el-table-column> -->
							<!-- <el-table-column prop="nationality" label="民族">
                                <template scope="scope">
                                    <span v-html="formatDicTionary(scope.row.nationality,'nationality_type')"></span>
                                </template>
							</el-table-column> -->
							<!-- <el-table-column prop="namePy" label="姓名首字母" min-width="100">
							</el-table-column> -->
							<!-- <el-table-column prop="namePinyin" label="姓名全拼" min-width="120">
							</el-table-column> -->
							<!-- <el-table-column prop="sex" label="性别">
                                <template scope="scope">
                                    <span v-html="formatDicTionary(scope.row.sex,'sex_type')"></span>
                                </template>
							</el-table-column> -->
                            <el-table-column prop="orgName" label="所属部门" width="350">
							</el-table-column>
                            <el-table-column prop="mobile" label="联系电话" width='200'>
							</el-table-column>
                            <el-table-column prop="createByUserName" label="创建人" width='180'>
							</el-table-column>
                            <el-table-column prop="createdDate" label="创建时间" :formatter="formatCreateDate" min-width="130">
							</el-table-column>
							<el-table-column label="操作" min-width="300" align='center'>
								<template slot-scope="scope">
                                    <el-button type="text" size="small" @click="userDetails(scope.$index, scope.row)">查看</el-button>
									<el-button type="text" size="small" @click="userEdit(scope.$index, scope.row)">修改</el-button>
									<el-button type="text" size="small" @click="userDelete(scope.$index, scope.row)">删除</el-button>
                                    <el-button type="text" size="small" @click="departmentAuthorizationView(scope.$index, scope.row)" v-if="false">管理范围</el-button>
                                    <el-button type="text" size="small" @click="roleAuthorizationView(scope.$index, scope.row)" v-if="false">角色授权</el-button>
                                    <el-button type="text" size="small" @click="menuAuthorizationView(scope.$index, scope.row)" v-if="false">菜单授权</el-button>
								</template>
							</el-table-column>
						</el-table>
						<!--工具条-->
						<el-col :span="23" class="toolbar marginTop10px">
							<el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentPageChange"
										   :current-page="pageNum" :page-size="pageSize" :total="total">
							</el-pagination>
						</el-col>
					</el-col>
				</el-row>
                <!-- <el-row type="flex" class="row-bg" justify="end">
					<el-pagination layout="total, prev, pager, next, jumper" @current-change="handleCurrentPageChange"
                                        :current-page="pageNum" :page-size="pageSize" :total="total">
                        </el-pagination>
				</el-row> -->

            <!--新增界面-->
            <Modal v-model="addFormVisible" title="新增用户" width='50%'>
                <el-container style="height: 500px;">  
                <el-card>          
				<el-form :model="addForm" label-width="120px" ref="addForm" :rules="rules">
                    <el-main style="height: 500px; border: 1px solid #eee;width:900px">
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="头像">
                                <el-upload
                                        :data="paramData"
                                        class="upload-demo"
                                        ref="upload"
                                        :action="uploadUrl"
                                        :on-remove="handleRemove"
                                        :before-remove="beforeRemove"
                                        :file-list="fileList"
                                        :limit="3"
                                        :on-exceed="handleExceed"
                                        :auto-upload="false"
                                        :on-success="uploadSuccess"
                                        list-type="picture">
                                    <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
                                    <el-button  size="small" type="success" @click="submitUpload">上传到服务器</el-button>
                                </el-upload>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="姓名" prop="name">
                                <el-input v-model="addForm.name"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="部门" prop="orgSerialNo">
                                <el-select placeholder="请选择" filterable v-model="addForm.orgSerialNo">
                                    <el-option v-for="item in organizations" :key="item.orgSerialNo" :label="item.name" :value="item.orgSerialNo">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="登陆名" prop="loginId">
                                <el-input v-model="addForm.loginId"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="跨职部门">
                                <el-select placeholder="请选择" filterable v-model="addForm.crossSection">
                                    <el-option v-for="item in organizations" :key="item.orgSerialNo" :label="item.name" :value="item.orgSerialNo">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="登录密码" prop="password">
                                <el-input v-model="addForm.password"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="出生日期">
                                <el-date-picker class="newdate" type="date" size="large" placeholder="请选择" v-model="addForm.birthday" value-format="yyyy-MM-dd"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="警号">
                                <el-input v-model="addForm.policeNumber"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="性别">
                                <el-radio-group v-model="addForm.sex">
                                    <el-radio class="radio" :label="1">男</el-radio>
                                    <el-radio class="radio" :label="2">女</el-radio>
                                </el-radio-group>
					        </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="身份证号码">
                                <el-input v-model="addForm.idCard"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!--<el-form-item label="应用图标" prop="logoImage">-->
                        <!--<template>-->
                            <!--<div>-->
                                <!--<el-upload-->
                                        <!--:data="paramData"-->
                                        <!--class="upload-demo"-->
                                        <!--ref="upload"-->
                                        <!--action="http://192.168.0.214:8784/m_manage/file/upload"-->
                                        <!--:on-remove="handleRemove"-->
                                        <!--:before-remove="beforeRemove"-->
                                        <!--:file-list="fileList"-->
                                        <!--:limit="1"-->
                                        <!--:on-exceed="handleExceed"-->
                                        <!--:auto-upload="false"-->
                                        <!--:on-success="uploadSuccess"-->
                                        <!--v-model="editForm.logoImage">-->
                                    <!--<el-button slot="trigger" size="small" type="primary">选取图片</el-button>-->
                                    <!--<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>-->
                                    <!--<el-input v-model="editForm.logoImage"  placeholder="应用图标" disabled></el-input>-->
                                <!--</el-upload>-->
                            <!--</div>-->
                        <!--</template>-->
                    <!--</el-form-item>-->
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="职位类别">
                                <el-select placeholder="请选择" filterable v-model="addForm.positionCategory">
                                    <el-option v-for="item in positionCategoryData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="民族">
                                <el-select  filterable v-model="addForm.nationality">
                                    <el-option v-for="item in nationData" :key="item.value" :label="item.name" :value="item.value" >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="所属警钟">
                                <el-select placeholder="请选择" filterable v-model="addForm.jobCategory">
                                    <el-option v-for="item in policeData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="手机号码">
                                <el-input v-model="addForm.mobile"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="所属岗位">
                                <el-select placeholder="请选择" filterable v-model="addForm.quarters">
                                    <el-option v-for="item in quartersData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="手机号2">
                                <el-input v-model="addForm.mobile2"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="所属角色">
                                <el-select
                                        v-model="roleIds"
                                        multiple
                                        collapse-tags
                                        placeholder="请选择">
                                    <el-option
                                            v-for="item in roleData"
                                            :key="item.id"
                                            :label="item.roleName"
                                            :value="item.id">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="手机号3">
                                <el-input v-model="addForm.mobile3"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!-- <el-col :span="12">
                            <el-form-item label="用户类型">
                                <el-select placeholder="请选择" filterable v-model="addForm.type">
                                    <el-option v-for="item in userTypeData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col> -->
                        <el-col :span="12">
                            <el-form-item label="用户状态">
                                <el-radio-group v-model="addForm.status">
                                    <el-radio class="radio" :label="1">启用</el-radio>
                                    <el-radio class="radio" :label="0">禁用</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="是否隐藏">
                                <el-radio-group v-model="addForm.isHide">
                                    <el-radio class="radio" :label="1">是</el-radio>
                                    <el-radio class="radio" :label="0">否</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!-- <el-row>
                        <el-col :span="12">
                            <el-form-item label="名字简拼">
                                <el-input v-model="addForm.namePy"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="名字拼音">
                                <el-input v-model="addForm.namePinyin"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row> -->
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="安全级别">
                                <el-select placeholder="请选择" filterable v-model="addForm.securityLevel">
                                    <el-option v-for="item in securityLevelData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="排序">
                                <el-input v-model="addForm.orderNo"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="公安邮箱">
                                <el-input v-model="addForm.email"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="数据来源">
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="家庭住址">
                                <el-input v-model="addForm.address"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-form-item label="用户签名">
                        <el-input type="textarea" v-model="addForm.remark"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="传真">
                        <el-input v-model="addForm.fax"></el-input>
                    </el-form-item>
                    <el-form-item label="家庭住址">
						<el-input v-model="addForm.address"></el-input>
					</el-form-item>
                    <el-form-item label="描述">
						<el-input v-model="addForm.description"></el-input>
					</el-form-item>
                    <el-form-item label="用户标签">
						<el-input v-model="addForm.lable"></el-input>
					</el-form-item> -->
                    <!-- <el-row>
                        <el-col :span="12">
                            <el-form-item label="用户类型">
                                <el-select v-model="addForm.hireWay" placeholder="用户类型">
                                    <el-option label="编制" value="1"></el-option>
                                    <el-option label="合同" value="2"></el-option>
                                    <el-option label="第三方" value="3"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="职务类别">
                                <el-select placeholder="请选择" filterable v-model="addForm.jobCategory">
                                    <el-option v-for="item in policeData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row> -->
                    <!-- <el-row>
                        <el-col :span="12">
                            <el-form-item label="是否修改密码">
                                <el-radio-group v-model="addForm.isInit">
                                    <el-radio class="radio" :label="0">未改密码</el-radio>
                                    <el-radio class="radio" :label="1">已改密码</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="数据来源">
                                <el-select v-model="addForm.source" placeholder="数据来源">
                                    <el-option label="HR" value="hr"></el-option>
                                    <el-option label="自增数据" value="self"></el-option>
                                    <el-option label="警综" value="jz"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row> -->
                   
                 </el-main>
				</el-form> 
                         
                </el-card>
                </el-container> 
				<div slot="footer" class="dialog-footer">
					<el-button @click.native="addFormVisible = false">取消</el-button>
					<el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
				</div>
            </Modal>

            <!--编辑界面-->
            <Modal v-model="editFormVisible" title="用户编辑" width='50%'>
                <el-card>
                <el-form :model="editForm" label-width="120px" ref="editForm" :rules="rules">
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="头像">
                                <el-upload
                                        :data="editForm.picture"
                                        class="upload-demo"
                                        ref="upload_edit"
                                        :action="uploadUrl"
                                        :on-remove="handleRemove"
                                        :before-remove="beforeRemove"
                                        :file-list="fileList"
                                        :limit="3"
                                        :on-exceed="handleExceed"
                                        :auto-upload="false"
                                        :on-success="uploadSuccess">
                                    <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
                                    <el-button  size="small" type="success" @click="submitUpload_edit">上传到服务器</el-button>
                                    <!-- <el-input v-model="editForm.picture" disabled></el-input> -->
                                </el-upload>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="姓名" prop="name">
                                <el-input v-model="editForm.name"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="所属部门" prop="orgSerialNo">
                                <el-select placeholder="请选择" filterable v-model="editForm.orgSerialNo">
                                    <el-option v-for="item in organizations" :key="item.orgSerialNo" :label="item.name" :value="item.orgSerialNo">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="登录名" prop="loginId">
                                <el-input v-model="editForm.loginId"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="跨职部门">
                                <el-select placeholder="请选择" filterable v-model="editForm.crossSection">
                                    <el-option v-for="item in organizations" :key="item.orgSerialNo" :label="item.name" :value="item.orgSerialNo">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="登录密码" prop="password">
                                <el-input v-model="editForm.password" :disabled="true"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="出生日期">
                                <el-date-picker class="newdate" type="date" placeholder="请选择" v-model="editForm.birthday" value-format="yyyy-MM-dd"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="警号 ">
                                <el-input v-model="editForm.policeNumber"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="性别">
                                <el-radio-group v-model="editForm.sex">
                                    <el-radio class="radio" :label="1">男</el-radio>
                                    <el-radio class="radio" :label="2">女</el-radio>
                                </el-radio-group>
					        </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="身份证号码">
                                <el-input v-model="editForm.idCard"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="职位类别">
                                <el-select placeholder="请选择" filterable v-model="editForm.positionCategory">
                                    <el-option v-for="item in positionCategoryData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="民族">
                                <el-select placeholder="请选择" filterable v-model="editForm.nationality">
                                    <el-option v-for="item in nationData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="所属警钟">
                                <el-select placeholder="请选择" filterable v-model="editForm.jobCategory">
                                    <el-option v-for="item in policeData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="手机号码">
                                <el-input v-model="editForm.mobile"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="所属岗位">
                                <el-select placeholder="请选择" filterable v-model="editForm.quarters">
                                    <el-option v-for="item in quartersData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="手机号2">
                                <el-input v-model="editForm.mobile2"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="所属角色">
                                <el-select
                                        v-model="roleIds"
                                        multiple
                                        collapse-tags
                                        placeholder="请选择">
                                    <el-option
                                            v-for="item in roleData"
                                            :key="item.id"
                                            :label="item.roleName"
                                            :value="item.id">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="手机号3">
                                <el-input v-model="editForm.mobile3"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!-- <el-col :span="12">
                            <el-form-item label="用户类型">
                                <el-select placeholder="请选择" filterable v-model="editForm.type">
                                    <el-option v-for="item in userTypeData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col> -->
                        <el-col :span="12">
                            <el-form-item label="用户状态">
                                <el-radio-group v-model="editForm.status">
                                    <el-radio class="radio" :label="1">启用</el-radio>
                                    <el-radio class="radio" :label="0">禁用</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="是否隐藏">
                                <el-radio-group v-model="editForm.isHide">
                                    <el-radio class="radio" :label="1">是</el-radio>
                                    <el-radio class="radio" :label="0">否</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="安全级别">
                                <el-select placeholder="请选择" filterable v-model="editForm.securityLevel">
                                    <el-option v-for="item in securityLevelData" :key="item.value" :label="item.name" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="排序">
                                <el-input v-model="editForm.orderNo"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="公安邮箱">
                                <el-input v-model="editForm.email"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="数据来源">
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="联系地址">
                                <el-input v-model="editForm.address"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-form-item label="用户签名">
                        <el-input type="textarea" v-model="editForm.remark"></el-input>
                    </el-form-item>
                    <!-- <el-row>
                        <el-col :span="12">
                            <el-form-item label="名字简拼">
                                <el-input v-model="editForm.namePy"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="名字拼音">
                                <el-input v-model="editForm.namePinyin"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-form-item label="传真">
                        <el-input v-model="editForm.fax"></el-input>
                    </el-form-item>
                    <el-form-item label="描述">
						<el-input v-model="editForm.description"></el-input>
					</el-form-item>
                    <el-form-item label="用户标签">
						<el-input v-model="editForm.lable"></el-input>
					</el-form-item>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="用户类型">
                                <el-select v-model="editForm.hireWay" placeholder="用户类型">
                                    <el-option label="编制" value="1"></el-option>
                                    <el-option label="合同" value="2"></el-option>
                                    <el-option label="第三方" value="3"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="是否修改密码">
                                <el-radio-group v-model="editForm.isInit">
                                    <el-radio class="radio" :label="0">还未修改密码</el-radio>
                                    <el-radio class="radio" :label="1">已经修改密码</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="数据来源">
                                <el-select v-model="editForm.source" placeholder="数据来源">
                                    <el-option label="HR" value="hr"></el-option>
                                    <el-option label="自增数据" value="self"></el-option>
                                    <el-option label="警综" value="jz"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row> -->
                </el-form>
                </el-card>
                <div slot="footer" class="dialog-footer">
                    <el-button @click.native="editFormVisible = false">取消</el-button>
                    <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
                </div>
            </Modal>

            <!-- :default-expanded-keys="showDate22" :default-checked-keys="showDate22" -->
            <!-- <el-dialog title="管理范围" :visible.sync="departmentAuthorizationDig" :modal-append-to-body="false"> -->
            <Modal v-model="departmentAuthorizationDig" title="管理范围" width='50%'>
                <el-card class="treeCard">
                <el-tree :data="treeData" show-checkbox node-key="orgSerialNo" :default-expanded-keys="bmShowData"  ref="bmtree"
                        highlight-current :props="defaultProps">
                </el-tree>
                </el-card>
                <div slot="footer" class="dialog-footer">
                    <el-button @click.native="quxiao">取消</el-button>
                    <el-button type="primary" @click.native="departmentAuthorizationSubmit" :loading="departmentAuthorizationLoading">提交</el-button>
                </div>
            </Modal>
            <!-- </el-dialog> -->

            <!-- <el-dialog title="角色授权" :visible.sync="roleAuthorizationDig" :modal-append-to-body="false"> -->
            <Modal v-model="roleAuthorizationDig" title="角色授权" width='50%'>
                <el-card class="treeCard">
                <el-tree :data="jstreeData" show-checkbox node-key="serialNo" :default-expanded-keys="jsShowData" ref="jstree"
                        highlight-current :props="defaultProps_js">
                </el-tree>
                </el-card>
                <div slot="footer" class="dialog-footer">
                    <el-button @click.native="roleAuthorizationDig = false">取消</el-button>
                    <el-button type="primary" @click.native="roleAuthorizationSubmit" :loading="roleAuthorizationLoading">提交</el-button>
                </div>
            </Modal>
            <!-- </el-dialog> -->

            <el-dialog title="菜单授权" :visible.sync="menuAuthorizationDig" :modal-append-to-body="false">
                <el-tree :data="menutreeData" show-checkbox node-key="id" :default-expanded-keys="menuShowData" ref="menutree"
                        highlight-current :props="defaultProps_menu">
                </el-tree>
                <div slot="footer" class="dialog-footer">
                    <el-button @click.native="menuAuthorizationDig = false">取消</el-button>
                    <el-button type="primary" @click.native="menuAuthorizationSubmit" :loading="menuAuthorizationLoading">提交</el-button>
                </div>
            </el-dialog>
	</section>
</template>

<script>
    import $ from 'jquery';
    import Vue from 'vue';
    import iviewArea from 'iview-area';
    Vue.use(iviewArea);

    import utils from '../../api/utils'
    import checks from '../../api/checks'
    import message from '../../api/message';
    //import NProgress from 'nprogress'
    import { getUserList,getMyUserlist, getree,geMytree, getOrganizationList, addUser, editUser, deleteUser, getRoleList, departmentAuthorization, departmentHave, addRolesForUser, roleHave,getDictionaryList,getMenuList, searchMenuTreeByuserId, addMenuForUser } from '../../api/api';

    export default {
        data() {
            return {
                //初始化字典数据
                nationData:[], //民族
                positionCategoryData:[], //职位类别
                quartersData:[], //所属岗位
                roleData:[], //角色
                roleIds:[], //角色
                securityLevelData:[], //安全级别
                // userTypeData:[], //用户类型
                crossSectionData:[], //跨职部门

                filters: {
                    name: ''
                },
                tableData: [],
                treeData: [],
                dicData:'',
                allDictData:[],// 所有的字典值
                jstreeData:[],
                menutreeData:[],
                total: 0,
                pageNum: 1,
                pageSize:10,
                listLoading: false,
                valueList: '',

                organizations:[],//所有部门数组

                bmShowData:[],//用户已有部门权限的数据

                jsShowData:[],//用户已有角色权限的数据

                menuShowData:[],//用户已有菜单权限的数据

                policeData:[],//警种数据

                defaultProps: {
                    id:'orgSerialNo',
					label: 'name',
					children: 'organizationVos',
                },
                defaultProps_js: {
                    label: 'roleName'
                },
                defaultProps_menu: {
                    id:"id",
                    label: 'title'
                },
                addFormVisible: false,//新增界面是否显示
				addLoading: false,
                //新增界面数据
				addForm: {
					orgId:'',
					orgSerialNo: '',
					name: '',
					userNum: '',
					loginId: '',
					picture: '',
					idCard: '',
                    birthday:null,
                    password:'',
                    nationality:null,
                    namePy:'',
                    namePinyin:'',
                    sex:0,
                    orderNo:null,
                    mobile:'',
                    mobile2:'',
                    mobile3:'',
                    telephone:'',
                    email:'',
                    fax:'',
                    address:'',
                    description:'',
                    lable:'',
                    status:null,
                    type:null,
                    hireWay:'',
                    jobCategory:null,
                    isInit:0,
                    createdBy:'',
                    createdDate:'',
                    lastUpdatedBy:'',
                    lastUpdatedDate:'',
                    isDeleted:0,
                    sourceId:'',
                    source:'',
                    policeNumber:'',//警号
                    positionCategory:'',//职位类别
                    quarters:'',//所属岗位
                    role:'',//所属角色
                    securityLevel:'',//安全级别
                    isHide:null,//是否隐藏
                },

                editFormVisible: false,//编辑界面是否显示
				editLoading: false,
				//编辑界面数据
				editForm: {
					orgId:'',
					orgSerialNo: '',
					name: '',
					userNum: '',
					loginId: '',
					picture: '',
					idCard: '',
                    birthday:null,
                    password:'',
                    nationality:null,
                    namePy:'',
                    namePinyin:'',
                    sex:0,
                    orderNo:null,
                    mobile:'',
                    mobile2:'',
                    mobile3:'',
                    telephone:'',
                    email:'',
                    fax:'',
                    address:'',
                    description:'',
                    lable:'',
                    status:null,
                    type:-1,
                    hireWay:'',
                    jobCategory:null,
                    isInit:0,
                    createdBy:'',
                    createdDate:'',
                    lastUpdatedBy:'',
                    lastUpdatedDate:'',
                    isDeleted:0,
                    sourceId:'',
                    source:'',
                    gangwei:'',
                    ganwei:'',
                    policeNumber:'',//警号
                    positionCategory:'',//职位类别
                    quarters:'',//所属岗位
                    role:'',//所属角色
                    securityLevel:'',//安全级别
                    isHide:null,//是否隐藏
                },

                rules: {
					orgSerialNo: [
						{ required: true, message: '请选择部门', trigger: 'blur' }
                    ],
                    name: [
						{ required: true, message: '请输入用户姓名', trigger: 'blur' }
                    ],
                    loginId: [
						{ required: true, message: '请输入登入名', trigger: 'blur' }
                    ],
                    password: [
						{ required: true, message: '请输入密码', trigger: 'blur' }
                    ]
				},

                //保存用户ID
                userId:"",

                //部门授权
                departmentAuthorizationDig: false,//部门授权界面是否显示
                departmentAuthorizationLoading: false,

                //角色授权
                roleAuthorizationDig: false,//角色授权界面是否显示
                roleAuthorizationLoading: false,

                //菜单授权
                menuAuthorizationDig: false,//菜单授权界面是否显示
                menuAuthorizationLoading: false,

                fileList: [],
				paramData:{sys:1,module:3,keyId:""},
                fileUrl:'0',

                uploadUrl:''
            }
        },
        methods: {
            	resetPassword: function (index, row) {
				this.$confirm('确认重置密码么?', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
					//NProgress.start();
				  //	let params = {classCode:row.classCode};
			          
                    setTimeout(()=>{
                            this.$message({
								message: '重置成功',
								type: 'success'
							});
                            this.listLoading = false;
                           // this.getList();
                    },1000);
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					}); 
				});
            },
            //实现回车键搜索功能
			searchEnterFun:function(e){
				this.getUserList();
            },
            unlock: function (index, row) {
				this.$confirm('确认解锁么?', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
					//NProgress.start();
				  //	let params = {classCode:row.classCode};
			          
                    setTimeout(()=>{
                            this.$message({
								message: '解锁成功',
								type: 'success'
							});
                            this.listLoading = false;
                           // this.getList();
                    },1000);
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					}); 
				});
            },
            orgFormatter: function (row, column){
                let result = '';
                this.organizations.forEach(obj => {
                    if(row.orgSerialNo === obj.orgSerialNo){
                        result = obj.name;
                    }
                });
                return result;
            },
            formatCreateDate: function (row, column) {
				return row.createdDate = (!row.createdDate || row.createdDate == '') ? '' : checks.formatDate(new Date(row.createdDate), 'yyyy-MM-dd hh:mm');
			},
            formatBirthday: function (row, column) {
				return row.birthday = (!row.birthday || row.birthday == '') ? '' : checks.formatDate(new Date(row.birthday), 'yyyy-MM-dd');
			},
            formatDicTionary(rowValue,rowType){
                 let rowName = '';
                this.allDictData.map(function(x){
                if(rowType==x.type){
                    if(rowValue==x.value){
                    rowName = x.name
                        return rowName;
                    }
                }
                });
                return rowName;
            },
            getFormatData(){
                let _this = this;
                let params = {
                    isPageAble:false,
                }
                getDictionaryList(params).then(function(res){
                    _this.allDictData = res.data.data.list
                })
            },
            formatDicTionary2: function(){
                console.log(this.valueList);
                return this.valueList;
            },
            formatDicTionary11:function(row,column,value){
                let dicType = this.allDictData.type;
                let dicValue = this.allDictData.values;
                let rowType = column.property;
                let rowName = '';
                this.allDictData.map(function(x){
                    // console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
                    // console.log(x)
                // if(rowType==x.type&&value==x.value){
                //     return x.name;
                //     console.log("nnnnnnxx")
                //     console.log(x.name)
                //     debugger;
                // }
                if(rowType==x.type){
                    if(value==x.value){
                    console.log("nnnnnnxx")
                    rowName = x.name
                    console.log(rowName)
                        return rowName;
                    }
                }
                });
                    console.log("outside........")
                    console.log(rowName)
                return rowName;
                // let type = column.property;
                // console.log(type)
                // $.ajax({
                //     url:'http://localhost:8784/uaa/dictionary/list?access_token=e32975aa-a792-418c-8943-ea31460cfbc7',
                //     data:{type:type,value:value},
                //     cache:false,
                //     async:false,
                //     type:'post',
                //     dataType:'json',
                //     contentType:"application/json;charset=utf-8",
                //     success:function(res){
                //         console.log(">>>>>>>>>>>>>>>>>dsfdfssssssssssssssssssssss");
                //         console.log(res)
                //     }
                // })
                // let _this = this;
                // // return this.valueList;
                // let name = '';
                // // if(''==name){
                //     let params ={
                //         type:column.property,
                //         value:value,
                //     }
                //     // return axios.all([getDictionaryList(params)])
                //     // .then(axios.spread(function (acct, perms) {
                //     //     // Both requests are now complete
                //     //     name = res.data.data.list[0].name;
                //     //     console.log(name)
                //     //     console.log(">>>>>>>>>>>>>>>IN");
                //     //     return name;
                //     // }));
                //         console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>yyyyyyyyyyyyyyyyyyyyyyyyy");
                //     let wuQi = getDictionaryList(params).then(function(res){
                //         name = res.data.data.list[0].name;
                //         _this.valueList = res.data.data.list[0].name;
                //         // console.log(name)
                //         // console.log(">>>>>>>>>>>>>>>IN");
                //         return name;
                //     });
                //     console.log('jianvary');
                //     console.log(wuQi);
                //         console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>fffffffffffffffffffffffffffyyy");
                    // return getDictionaryList(params).then(function(res){
                    //     name = res.data.data.list[0].name;
                    //     console.log(name)
                    //     console.log(">>>>>>>>>>>>>>>IN");
                    //     return name;
                    // });

                    // 遍历 allDictData ，判断 type 和 key
                    //return allDictData.get(tpye,key);


                    // console.log(name)
                    // console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>dic");
                //return name;
                // }
            },
            // formatDicTionary(a,b){
            //     debugger;
            // },
            handleCurrentPageChange: function (pageNum) {// 翻页动作
                this.pageNum = pageNum;
                this.getUserList();// 翻页后刷新页面数据
            },
            //获取列表
            getUserList() {
                let params = {
                    pageNum: this.pageNum,
                    pageSize: this.pageSize,
                    name: this.filters.name,
                    orgSerialNo:this.$refs.tree.getCurrentKey()
                };
                this.listLoading = true;
                //NProgress.start();
                getMyUserlist(params).then(function(result){
                    if(message.msg(result,this,false)){
                        this.tableData = result.data.list;
                        this.pageNum = result.data.pageNum;
                        this.pageSize = result.data.pageSize;
                        this.total = result.data.total;
                        this.listLoading = false;
                    }else{
                        this.listLoading = false;
                    }
                }.bind(this)).catch(function (error) {
                    this.listLoading = false;
                    console.log(error);
                }.bind(this));
            },
            doGeMytree() {
                let params = {};
                geMytree(params).then(function(result){
                    //console.log(JSON.stringify(result.data));
                    // this.treeData = JSON.parse(JSON.stringify(result.data));
                    if(message.msg(result,this,false)){
                        this.treeData = result.data;
                    }
                }.bind(this)).catch(function (error) {
                    this.listLoading = false;
                    console.log(error);
                }.bind(this));
            },
            toGetList:function(data){
                console.log('tree');
                this.getUserList();
            },
            //显示新增界面
			userAdd: function () {
                this.addForm = {
					orgId:'',
					orgSerialNo:this.$refs.tree.getCurrentKey(),
					name: '',
					userNum: '',
					loginId: '',
					picture: '',
					idCard: '',
                    birthday:null,
                    password:'',
                    nationality:"汉族",
                    namePy:'',
                    namePinyin:'',
                    sex:'',
                    orderNo:null,
                    mobile:'',
                    mobile2:'',
                    mobile3:'',
                    telephone:'',
                    email:'',
                    fax:'',
                    address:'',
                    description:'',
                    lable:'',
                    status:null,
                    type:null,
                    hireWay:'',
                    jobCategory:null,
                    isInit:0,
                    createdBy:'',
                    createdDate:'',
                    lastUpdatedBy:'',
                    lastUpdatedDate:'',
                    isDeleted:0,
                    sourceId:'',
                    source:'',
                    policeNumber:'',//警号
                    positionCategory:'',//职位类别
                    quarters:'',//所属岗位
                    role:'',//所属角色
                    securityLevel:'',//安全级别
                    isHide:null,//是否隐藏
                },
                this.getOrganizations();
                this.roleIds = [];
                this.addFormVisible = true;
            },
            //查询组织机构
			getOrganizations: function () {
				let params = {
                    pageNum: 1,
	                pageSize: 10000
	            };
            	getOrganizationList(params).then(function (result) {
					this.organizations = result.data.data.list;
	            }.bind(this)).catch(function (error) {
	                console.log(error);
	            }.bind(this));
            },
            // 警种数据
           getPolices: function () {
                let params = {
                    pageNum: 1,
					pageSize: 10000,
					type:'jobCategory'
                };
                getDictionaryList(params).then(function(result){
                    this.policeData = result.data.data.list;
                }.bind(this)).catch(function (error) {
                    console.log(error);
                }.bind(this));
			},
            // 新增
	        addSubmit: function () {
                if(this.addForm.orgSerialNo === this.addForm.crossSection){
                    this.$message({
                        message: '部门与跨职部门不能选择一样的！',
                        type: 'info'
                    });
                    return;
                }
	            this.$refs.addForm.validate((valid) => {
	                if (valid) {
	                    this.$confirm('确认提交吗？', '提示', {}).then(() => {
	                        this.addLoading = true;
	                        // NProgress.start();
                            let params = Object.assign({}, this.addForm);
                            params.birthday = Date.parse(new Date(params.birthday));
                            params.picture = this.fileUrl;
                            let roles = '';
                            this.roleIds.forEach(obj => {
                                roles += obj + ",";
                            });
                            if(roles.length>0){
                                params.role = roles.substring(0,roles.length-1);
                            }else{
                                params.role = roles;
                            }
	                        addUser(params).then((res) => {
	                            this.addLoading = false;
	                            // NProgress.done();
	                            this.$message({
	                                message: '提交成功',
	                                type: 'success'
	                            });
	                            this.$refs['addForm'].resetFields();
	                            this.addFormVisible = false;
	                            this.getUserList();
	                        });
	                    });
	                }
	            });
            },
            // 显示编辑界面
	        userEdit: function (index, row) {
                this.roleIds = []; // 重新初始化
                this.getOrganizations();
                this.editFormVisible = true;
                this.editForm = Object.assign({}, row);
                this.editForm.birthday = checks.formatDate(new Date(row.birthday), 'yyyy-MM-dd');
                if(row.role === ''){
                    return;
                }
                let roles = row.role.split(",");
                roles.forEach(obj => {
                    this.roleIds.push(parseInt(obj));
                });
            },
            //编辑
			editSubmit: function () {
                if(this.editForm.orgSerialNo === this.editForm.crossSection){
                    this.$message({
                        message: '部门与跨职部门不能选择一样的！',
                        type: 'info'
                    });
                    return;
                }
				this.$refs.editForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => {
							this.editLoading = true;
							//NProgress.start();
                            let params = Object.assign({}, this.editForm);
                            params.birthday = Date.parse(new Date(params.birthday));
                            params.picture = this.fileUrl;
                            params.createdDate = Date.parse(new Date(params.createdDate));
                            if(params.lastUpdatedDate != null || params.lastUpdatedDate != ''){
                                params.lastUpdatedDate = Date.parse(new Date(params.lastUpdatedDate));
                            }
                            let roles = '';
                            this.roleIds.forEach(obj => {
                                roles += obj + ",";
                            });
                            if(roles.length>0){
                                params.role = roles.substring(0,roles.length-1);
                            }else{
                                params.role = roles;
                            }
							editUser(params).then((res) => {
                                message.msg(res,this,true);
								this.editLoading = false;
								this.$refs['editForm'].resetFields();
								this.editFormVisible = false;
								this.getUserList();
							});
						});
					}
				});
            },
            //删除
			userDelete: function (index, row) {
				this.$confirm('确认删除该记录吗?', '提示', {
					type: 'warning'
				}).then(() => {
                    this.listLoading = true;
					//NProgress.start();
					deleteUser(row.userId).then((res) => {
						this.listLoading = false;
						//NProgress.done();
                        message.msg(res,this,true);
						this.getUserList();
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},
            // 显示部门授权界面
	        departmentAuthorizationView: function (index, row) {
                this.bmShowData = [];//每次重新初始化数组
                let _this = this;
                this.userId = row.userId;
                //setTimeout(function(){
                    let params = {
                        userId : row.userId
                    };
                    departmentHave(params).then(function(result){
                        result.data.data.forEach(obj => {
                            _this.bmShowData.push(obj.orgSerialNo);
                        });
                        _this.departmentAuthorizationDig = true;
                        setTimeout(function(){
                            _this.$refs.bmtree.setCheckedNodes(result.data.data);
                            //_this.$refs.bmtree.defaultExpandedKeys = _this.showDate22;
                        },100);
                        //_this.$refs.bmtree.setCheckedNodes(result.data.data);
                    }.bind(this)).catch(function (error) {
                        console.log(error);
                    }.bind(this));
                //},500);
            },
            quxiao: function () {
                this.bmShowData = [];//每次重新初始化数组
                this.departmentAuthorizationDig = false;
                //this.getUserList();
            },
            departmentAuthorizationSubmit: function () {
                let allNodes = this.$refs.bmtree.getCheckedNodes();
                let organizationArr = [];
                allNodes.forEach(obj => {
                    organizationArr.push({"orgSerialNo":obj.orgSerialNo,"parentNo":obj.parentSerialNo});
                });
                this.$confirm('确认提交吗？', '提示', {}).then(() => {
                    this.departmentAuthorizationLoading = true;
                    let params = {
                        pageNum: 1,
                        pageSize: 10000,
                        userSerialNo : this.userId,
                        userOrgList : organizationArr
                    }
                    departmentAuthorization(params).then((res) => {
                        this.departmentAuthorizationLoading = false;
                        message.msg(res,this,true);
                        this.departmentAuthorizationDig = false;
                        this.getUserList();
                    });
                });
            },
            // 显示角色授权界面roleHave
	        roleAuthorizationView: function (index, row) {
                this.jsShowData = [];//每次重新初始化数组
                let _this = this;
                this.userId = row.userId;
                roleHave(row.userId).then(function(result){
                    if(result.data.code === "B104001"){
                        this.$message({
                            message: result.data.msg,
                            type: 'info'
                        });
                    }else{
                        result.data.data.forEach(obj => {
                            _this.jsShowData.push(obj.serialNo);
                        });
                        _this.roleAuthorizationDig = true;
                        setTimeout(function(){
                            _this.$refs.jstree.setCheckedNodes(result.data.data);
                        },100);
                    }
                }.bind(this)).catch(function (error) {
                    console.log(error);
                }.bind(this));
            },
            //查询角色
			getroles: function () {
                let params = {
                    pageNum: 1,
                    pageSize: 10000
                };
                getRoleList(params).then(function(result){
                    this.jstreeData = result.data.data.list;
                    this.roleData = result.data.data.list; //获取所有角色
                }.bind(this)).catch(function (error) {
                    console.log(error);
                }.bind(this));
            },
            roleAuthorizationSubmit: function () {
                let allNodes = this.$refs.jstree.getCheckedNodes();
                let roleArr = [];
                allNodes.forEach(obj => {
                    roleArr.push(obj.id);
                });
                this.$confirm('确认提交吗？', '提示', {}).then(() => {
                    this.departmentAuthorizationLoading = true;
                    let params = {
                        pageNum: 1,
                        pageSize: 10000,
                        userId : this.userId,
                        roleIds : roleArr
                    }
                    addRolesForUser(params).then((res) => {
                        this.roleAuthorizationLoading = false;
                        message.msg(res,this,true);
                        this.roleAuthorizationDig = false;
                        this.getUserList();
                    });
                });
            },
            menuAuthorizationView: function (index, row) {
                this.menuShowData = [];//每次重新初始化数组
                let _this = this;
                this.userId = row.userId;
                searchMenuTreeByuserId(row.userId).then(function(result){
                    if(message.msg(result,_this,false)){
                        result.data.data.forEach(obj => {
                            _this.menuShowData.push(obj.id);
                        });
                        _this.menuAuthorizationDig = true;
                        setTimeout(function(){
                            _this.$refs.menutree.setCheckedNodes(result.data.data);
                        },100);
                    }
                }.bind(this)).catch(function (error) {
                    console.log(error);
                }.bind(this));
            },
            //查询菜单
			getMenuList: function () {
                let params = {
                    pageNum: 1,
                    pageSize: 10000
                };
                getMenuList(params).then(function(result){
                    this.menutreeData = result.data.data;
                }.bind(this)).catch(function (error) {
                    console.log(error);
                }.bind(this));
            },
            menuAuthorizationSubmit: function () {
                let allNodes = this.$refs.menutree.getCheckedNodes();
                let menuArr = [];
                allNodes.forEach(obj => {
                    menuArr.push(obj.id);
                });
                this.$confirm('确认提交吗？', '提示', {}).then(() => {
                    this.menuAuthorizationLoading = true;
                    let params = {
                        pageNum: 1,
                        pageSize: 10000,
                        userId : this.userId,
                        menuIds : menuArr
                    }
                    addMenuForUser(params).then((res) => {
                        this.menuAuthorizationLoading = false;
                        if(message.msg(res,this,true)){
                            this.menuAuthorizationDig = false;
                            this.getUserList();
                        }
                    });
                });
            },
            submitUpload() {
                this.paramData.keyId="9999999999999999999999";
                this.$refs.upload.submit();
            },submitUpload_edit() {
                this.paramData.keyId="9999999999999999999999";
                this.$refs.upload_edit.submit();
            },
            handleRemove(file, fileList) {
                console.log("移除文件");
                console.log(file, fileList);
            },
            beforeRemove(file, fileList) {
                return this.$confirm(`确定移除 ${ file.name }？`);
            },
            handlePreview(file) {
                console.log("点击文件");
                console.log(file);
            },
            handleExceed(files, fileList) {
                this.$message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
            },
            beforeRemove(file, fileList) {
                return this.$confirm(`确定移除 ${ file.name }？`);
            },
            uploadSuccess(response, file, fileList){
				this.fileUrl = response.data.fileUri;
                console.log(response)
            },
        },

        watch: {

        },
        computed: {
            // showDate22: function(){
            //     return this.test1;
            // }
        },
        mounted() {
            this.doGeMytree();
            this.getUserList();
            this.getroles();
            this.getMenuList();
            this.getFormatData();
            this.getPolices();
            this.uploadUrl = utils.uploadUrl(); //设置图片上传地址
            this.nationData = utils.getDictDatasByType('nationality_type'); //民族
            this.positionCategoryData = utils.getDictDatasByType('user_duty'); //职位类别
            this.quartersData = utils.getDictDatasByType('user_type');//所属岗位
            // this.roleData = utils.getDictDatasByType('');//角色
            this.securityLevelData = utils.getDictDatasByType('user_security_level');//安全级别
            // this.userTypeData = utils.getDictDatasByType('');//用户类型
            this.crossSectionData = utils.getDictDatasByType('');//跨职部门

            //this.getOrganizations();
    }
};
</script>
<style scoped>
  .custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    padding-right: 8px;
  }
</style>
